/* 
   Try This 2-2 
 
   Print a truth table for the logical operators. 
*/ 
class LogicalOpTable {    
  public static void main(String args[]) {    
 
    //boolean p, q; 
 
    System.out.println("P\tQ\tAND\tOR\tXOR\tNOT"); 
 
    //p = true; q = true;
	int p = 1;
	int q = 1;
	
    System.out.print(p + "\t" + q +"\t"); 
    System.out.print((p&q) + "\t" + (p|q) + "\t"); 
    System.out.println((p^q) + "\t" + (p ^ 1)); 
 
    p = 1; q = 0; 
    System.out.print(p + "\t" + q +"\t"); 
    System.out.print((p&q) + "\t" + (p|q) + "\t"); 
    System.out.println((p^q) + "\t" + (p ^ 1)); 
 
    p = 0; q = 1; 
    System.out.print(p + "\t" + q +"\t"); 
    System.out.print((p&q) + "\t" + (p|q) + "\t"); 
    System.out.println((p^q) + "\t" + (p ^ 1)); 
 
    p = 0; q = 0; 
    System.out.print(p + "\t" + q +"\t"); 
    System.out.print((p&q) + "\t" + (p|q) + "\t"); 
    System.out.println((p^q) + "\t" + (p ^ 1)); 
  }    
}